<script setup>
import { onLaunch } from "@dcloudio/uni-app"
import store from '@/store/index.js'

onLaunch(() => {
  console.log('App Launch')
  
  // 检查登录状态
  const user = uni.getStorageSync('user')
  if (user) {
    store.commit('login', JSON.parse(user))
    
    // 获取数据
    store.dispatch('fetchStats')
    store.dispatch('fetchRecommendations')
  }
})
</script>

<style>
/* 全局样式 */
page {
  background-color: #f5f7fa;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 解决H5端滚动条问题 */
::-webkit-scrollbar {
  display: none;
  width: 0 !important;
  height: 0 !important;
  -webkit-appearance: none;
  background: transparent;
}

/* 全局动画 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}
</style>